//第二排大轮播图
let bignext_btn = document.getElementById('bignext');
let bigpre_btn = document.getElementById('bigpre');
let big_lb_list = document.getElementById('big_big_lb_list');
let bigdots = document.getElementById('bigdot').getElementsByTagName("span");
let big_left = 0;
let big_index = 0;  //图片下标
//绑定下一张图片的按钮事件
bignext_btn.onclick = () => {
  
    big_left = parseInt(big_lb_list.style.left);//起点位置
    let new_big_left = big_left - 380;//终点
    if (new_big_left < -2364) {
        new_big_left = 0;
        //直接跳到第一张
        big_lb_list.style.left = 0
    }

    big_index = ++big_index > 2 ? 0 : big_index;//图片焦点下标改变
    // console.log(new_big_left);
    big_lb_list.style.left = new_big_left + "px";
    changeDot()
    
}
//绑定上一张图片的按钮事件
bigpre_btn.onclick = () => {
    
    big_left = parseInt(big_lb_list.style.left);
    let new_big_left = big_left + 788;
    if (new_big_left > 0) {
        new_big_left = -2364;
        big_lb_list.style.left = -2364;

    }
    big_index = --big_index < 0 ? 2: big_index;//图片焦点下标改变
    // console.log(big_index);
    big_lb_list.style.left = new_big_left + "px";
    changeDot()
}

//绑定焦点点击图标
for (let i = 0; i < dots.length; i++) {
    dots[i].onclick = () => {
        if (big_index == i || status) {
            return false;
        }
        
        let new_big_big_index = i;
        new_big_left = i * -380;
        big_index = new_big_big_index;

        changeDot()
        big_lb_list.style.left = new_big_left + "px";

    }
}
//检查焦点
function changeDot() {
    
    for (let i = 0; i < dots.length; i++) {
        dots[i].className = "";
    }
    dots[big_index].className = 'on'
}



